// 本文件是将本地存储的函数封装

// 取
export function getLocalStorage(key) {
  try {
    let re = JSON.parse(localStorage.getItem(key))  //Json.parse("") 会报错
    return re
  } catch (error) {
    return localStorage.getItem(key)
  }
}

// 存
export function setLocalStorage(key, value) {
  console.log(value instanceof Object)
  if (value instanceof Object) {
    value = JSON.stringify(value)
  }
  localStorage.setItem(key, value)
}
// 删
export function removeLocalStorage(key) {
  localStorage.removeItem(key)
}